package com.lianqi.emcpframework.design.domain.aggregate;

import com.lianqi.emcpframework.design.domain.Entity;
import com.lianqi.emcpframework.design.domain.event.DomainEvent;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.List;

/**
 * @program emcp-framework
 * @ClassName Aggregate
 * @description: 聚合根定义接口
 * @author: sky
 * @create: 2019/06/06 11:02
 */
public interface Aggregate<T,ID> extends Entity<T,ID> {
    /**
     * 获取领域事件
     * @return
     */
    @JsonIgnore
    List<DomainEvent> getEvents();

    /**
     * 清除领域事件
     */
    void cleanEvents();
}
